<?php
if (strtoupper(PHP_OS) === 'WINNT') {
    $mode = 'nt';
} else {
    if (stripos(php_uname(), 'rhcloud') !== false) {
        $mode = 'openshift';
    } elseif (stripos(php_uname(), 'x86_64') !== false) {
        $mode = 'azure';
    } else {
        $mode = 'home';
    }
}
define('MODE', $mode);
$app->config('mode', $mode);

$app->configureMode('azure', function () use ($app) {
    $app->config(array(
        'log.enable' => true,
        'debug' => true
    ));
    $app->dbconf = array(
        'driver' => 'Pdo_Mysql',
        'database' => 'yourall',
        'username' => 'root',
        'password' => 'root',
        'host'=>'192.168.1.123',
        'charset'=>'utf8'
    );
});
$app->configureMode('home', function () use ($app) {
    $app->config(array(
        'log.enable' => true,
        'debug' => true
    ));
    $app->dbconf = array(
        'driver' => 'Pdo_Pgsql',
        'database' => 'yourall',
        'host' => '127.0.0.1',
        'username' => 'zhangwei',
        'password' => 'root'
    );
});
$app->configureMode('nt', function () use ($app) {
    $app->config(array(
        'log.enable' => true,
        'debug' => true
    ));
    $app->dbconf = array(
        'driver' => 'Pdo_Mysql',
        'database' => 'yourall',
        'username' => 'root',
        'password' => 'root'
    );
});
$c['dbconf'] = $app->dbconf;
